// pages/fenlei/fenlei.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    a:1,
    b:{},
    fenleiList:[
      {
        id:1,
        text:"女小汉服"
      },
      {
        id:2,
        text:"男小汉服"
      },
      {
        id:3,
        text:"男自行车"
      },
      {
        id:4,
        text:"女自行车"
      },
      {
        id:5,
        text:"体育器材"
      },
      {
        id:6,
        text:"滑板"
      },
      {
        id:7,
        text:"溜冰鞋"
      },
      {
        id:8,
        text:"游泳圈"
      },
      {
        id:9,
        text:"儿童读本"
      },
      {
        id:10,
        text:"积木拼图"
      },
      {
        id:11,
        text:"平衡车"
      },
       {
        id:12,
        text:"童车"
      },
      {
        id:13,
        text:"扭扭车"
      },
    ],
    wupingList:[
      {
        id:1,
        mingzi:"汉服儿童女短袖连衣裙",
        img:'/tupian/分类/1.webp',
        state:"已租完",
        feiyong:120
      },
      {
        id:1,
        mingzi:"汉服儿童女短袖连衣裙",
        img:'/tupian/后台/儿童用品img/1/1-1.webp',
        state:"已租完",
        feiyong:120
      },
      {
        id:1,
        mingzi:"汉服儿童女短袖连衣裙",
        img:'/tupian/分类/1.webp',
        state:"已租完",
        feiyong:120
      },
      {
        id:1,
        mingzi:"汉服儿童女短袖连衣裙",
        img:'/tupian/分类/1.webp',
        state:"已租完",
        feiyong:120
      },
      {
        id:1,
        mingzi:"汉服儿童女短袖连衣裙",
        img:'/tupian/分类/1.webp',
        state:"已租完",
        feiyong:120
      },
      {
        id:1,
        mingzi:"汉服儿童女短袖连衣裙",
        img:'/tupian/分类/1.webp',
        state:"已租完",
        feiyong:120
      },
      {
        id:1,
        mingzi:"汉服儿童女短袖连衣裙",
        img:'/tupian/分类/1.webp',
        state:"已租完",
        feiyong:120
      },
      {
        id:1,
        mingzi:"汉服儿童女短袖连衣裙",
        img:'/tupian/分类/1.webp',
        state:"已租完",
        feiyong:120
      },
      {
        id:1,
        mingzi:"汉服儿童女短袖连衣裙",
        img:'/tupian/分类/1.webp',
        state:"已租完",
        feiyong:120
      }, {
        id:1,
        mingzi:"汉服儿童女短袖连衣裙",
        img:'/tupian/分类/1.webp',
        state:"已租完",
        feiyong:120
      },
      
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    wx.request({
      url: 'http://localhost:80/articles/category',
      method:"POST",
      data:{
        category:this.data.a,
      },
      header:{
        'content-type': 'application/x-www-form-urlencoded'
    },
    success:res=>{
      this.setData({
        wupingList:res.data.data
      })
      console.log('aaaaa')
     console.log(this.data.wupingList);

    }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  zhifu:function(e){
      // console.log(e.currentTarget.dataset.index)
      var b=e.currentTarget.dataset.index
      this.setData({
        a:b
      })
      wx.request({
        url: 'http://localhost:80/articles/category',
        method:"POST",
        data:{
          category:this.data.a,
        },
        header:{
          'content-type': 'application/x-www-form-urlencoded'
      },
      success:res=>{
        this.setData({
          wupingList:res.data.data
        })
        console.log('aaaaa')
       console.log(this.data.wupingList);
  
      }
      })
     
      // console.log(this.data.a)
  },
  sousuo:function(){
    wx.navigateTo({
      url: '/pages/sousuo/sousuo',
    })
  },
  xiangqing:function(e){
    // console.log(this.data.wupingList[e.currentTarget.dataset.index-1])
    wx.navigateTo({
      url: '/pages/xiangqing/xiangqing?b='+JSON.stringify(this.data.wupingList[e.currentTarget.dataset.index])
    })
    // wx.navigateTo({
    //   url: 'url',
    // })
  }
})

